package net 
{
	import log.Log;
	import net.message.IMsgBody;
	import net.message.Message;
	/**
	 * ...
	 * @author carlor
	 */
	public class GameNet 
	{
		private var _gameServer: IGameServer;
		
		public function GameNet(gameServer: IGameServer) 
		{
			_gameServer = gameServer;
		}
		
		public function get Net(): GSocket
		{
			return _gameServer.socket;
		}
		
		public function sendToServer(method: int, body: IMsgBody, isZip: Boolean=false): void
		{
			var message: Message = new Message(method, body);
			//Log.formatErrorLog("send Message id=%%", [method]);
			Engine.dialogManager.handlePacket("onShowMessage", "send Message id="+method);
			_gameServer.sendMssage(message.toBuffer());
		}
		
		public function registerRecvFromServer(method: int, callback: Function): void
		{
			_gameServer.registerRecvFromServer(method, callback);
		}
	}

}